/**   
 * All rights Reserved, Designed By MiGu  
 * Copyright:    Copyright(C) 2016-2020  
 * Company       MiGu  Co., Ltd.
*/
package com.migu.spms.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.migu.spms.dao.entity.RequireCommentCriteria;
import com.migu.spms.dao.entity.RequireCommentDO;
import com.migu.spms.dao.inf.IRequireCommentDO;
import com.migu.spms.service.data.User;
import com.migu.spms.service.inf.IRequireCommentService;
import com.migu.spms.webapi.data.AddCommentRequest;


/**   
 * RequireCommentServiceImpl类
 * 项目名称:  SPMS功能需求
 * 包名称:    com.migu.spms.service.impl   
 * 类名称:    RequireCommentServiceImpl.java
 * 类描述:    
 * 创建人:    wcr   
 * 创建时间:  2017年6月21日 下午3:34:40   
 */
@Transactional
@Service("requireCommentServiceImpl")
public class RequireCommentServiceImpl implements IRequireCommentService {

    @Resource(name="IRequireCommentDO")
    IRequireCommentDO requireCommentDO;
    
    @Override
    public int insertRequireComment(AddCommentRequest comment, User user) throws Exception {
        RequireCommentCriteria record = new RequireCommentCriteria();
        record.setComment(comment.getComment());
        record.setCreateTime(new Date());
        record.setFunctionRequireId(comment.getFunctionRequireId());
        record.setProcessorId(Long.valueOf(user.getUserId()));
        record.setProcessorName(user.getUserName());   
        return requireCommentDO.insertSelective(record);
    }

    @Override
    public List<RequireCommentDO> selectRequireCommentList(RequireCommentCriteria criteria) {
        return requireCommentDO.selectRequireCommentList(criteria);
    }

}
